﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>延迟申请</title>
    <link href="../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" />
    <link href="../Scripts/easyUI145/themes/icon.css" rel="stylesheet" />
    <link href="../Scripts/easyUI145/demo/demo.css" rel="stylesheet" />
    <script src="../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../Scripts/easyUI145/jquery.easyui.min.js"></script>

    <script src="../Scripts/config.js" type="text/javascript"></script>
    <script src="../Comm/Gener.js" type="text/javascript"></script>
    <script src="../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" />
    <script type="text/javascript">

        var workid = GetQueryString("WorkID");
        var webUser = new WebUser();
        $(function () {
            var gwf = new Entity("BP.WF.GenerWorkFlow", workid);
            if (gwf.WFState == 4) {
                if (GetQueryString("hungType") == "1") {
                    window.parent.returnWorkWindowClose("");
                }
            }
            //pri = gwf.PRI;
            //$("[name='PRI'][value='" + pri + "']").prop("checked", "checked");
            //if (PRIEnable == 1) {
            //    $("#Btns").hide();
            //    $("input[name=PRI]").each(function () {
            //        $(this).attr("disabled", true);
            //    });
            //}
        });

        function Save() {

            //原因.
            var docs = $("#TB_Doc").val();

            //方式.
            var delayWay = $("input[name='DelayWay']:checked").val();
            var reldate = $("#TB_RelDate").datetimebox("getValue");

            if (delayWay == "1" && reldate == "") {
                alert("请选择截止时间");
                return;
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            handler.AddPara("WorkID", GetQueryString("WorkID"));
            handler.AddPara("DelayWay", delayWay);
            handler.AddPara("Doc", docs);
            handler.AddPara("RelDate", reldate);
            var data = handler.DoMethodReturnString("Hungup_Save");
            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }
            if (GetQueryString("hungType") == "0") {
                self.location = "../../CCMobilePortal/Home.htm";
                return;
            }

            window.parent.returnWorkWindowClose(data);
        }

        function Cancel() {
            if (GetQueryString("hungType") == "0") {
                self.location = "../../CCMobilePortal/Home.htm";
                return;
            }
            if (window.parent != null && window.parent.returnWorkWindowClose != null) {
                window.parent.returnWorkWindowClose("取消");
            }
        }
    </script>

</head>
<body>

    <div style="padding:10px 10px;text-align:center">

        <label> 延迟原因： </label>
        <textarea id="TB_Doc" style="width:95%;height:100px;"></textarea>

        <label> 延迟方式： </label>
        <label>
            <input type="radio" id="RB_DelayWay_0" value="0" name="DelayWay" checked="checked" /> 无限期的延迟.
        </label>
        <label>
            <input type="radio" id="RB_DelayWay_1" name="DelayWay" value="1" /> 按时间延迟.
            延期到：
            <!--<input type="text" id="TB_RelDate" />-->
            <input class="easyui-datetimebox" name="TB_RelDate" id="TB_RelDate"
                   data-options="required:true,showSeconds:false" style="width:150px" />
        </label>

    </div>
    <div id="Btns" style="text-align:right;margin-bottom:10px;margin-right:10px;">
        <input type="button" id="SaveBtn" value="提交延迟申请" onclick="Save()" />
        <input type="button" id="CancelBtn" value="取消" onclick="Cancel()" />
    </div>

</body>
</html>
